package com.sourcetrip.raw.adt.interfaces;

/**
 * @author: ZhouBert
 * @date: 2020/12/9
 * @description: 映射的接口
 */
public interface MyMap<K, V> {

	int size();

	default boolean isEmpty() {
		return size() == 0;
	}

	void clear();

	V put(K key, V value);

	V get(K key);

	V remove(K key);

	boolean containsKey(K key);

	boolean containsValue(V value);

	void traversal(Visitor<K, V> visitor);

	public static abstract class Visitor<K, V> {
		boolean stop;

		public abstract boolean visit(K key, V value);
	}
}
